#ubuntu的内核源码树，如果要编译在ubuntu中安装的模块就打开这2个
# KERN_VER = $(shell uname -r)
# KERN_DIR = /lib/modules/$(KERN_VER)/build	
# 使用ubuntu内核测试，.ko文件可以直接在ubuntu中insmod
		

#  驱动模版
# 开发板的linux内核的源码树目录
# KERN_DIR = /root/driver/kernel
#KERN_DIR = /home/denganzhi/Desktop/bsp/kernel
KERN_DIR = /home/robin/work/kernel-rockchip-nanopi4-linux-v4.4.y


# 如果是Android
# export ARCH=arm64
#export arm64_gcc=/mnt/work2/rk3566_3568_sourcecode/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc	
# 开发板的linux内核的源码树目录
#KERN_DIR=/mnt/work2/rk3566_3568_sourcecode/kernel
#$(arm64_gcc) -o app.o app.c -static


#06.Platfrom->platform_device_rk3568_1.c
#export ARCH=arm64
#export CROSS_COMPILE=/mnt/work2/rk3566_3568_sourcecode/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
#export arm64_gcc=/mnt/work2/rk3566_3568_sourcecode/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc	
#KERN_DIR=/mnt/work2/rk3566_3568_sourcecode/kernel



obj-m	+= 02_module_test_new_api2.o


APP = app


all:
	make -C $(KERN_DIR) M=`pwd` modules
	aarch64-linux-gnu-gcc $(APP).c -o $(APP)
#	arm-none-linux-gnueabi-gcc app.c -o app.o
# 	gcc app.c -o app.o
#   gcc app_llseek.c -o app_llseek.o


install:
	scp *.ko $(APP) root@192.168.107.61:/drv_code

	

cp:
	cp *.ko /home/denganzhi/Desktop/rootfs/rootfs/driver_test
	cp app.o /home/denganzhi/Desktop/rootfs/rootfs/driver_test

.PHONY: clean	
clean:
	make -C $(KERN_DIR) M=`pwd` modules clean
	rm -rf app.o
	$(RM) $(APP)

